class Sector
  include DataMapper::Resource
  storage_names[:default] = "Sector"
  
  property :id,          Serial
  property :title,       String,        :required => true, :length => 500
  property :icon_id,     Integer
  property :image_id,    Integer
  property :order,       Integer
  property :hot,         Boolean
  property :archived,    Boolean
  property :summary,     String,        :length => 500
  property :description, Text,          :lazy => false
  timestamps :at
  
  has n, :courses
  belongs_to :icon, 'Document',
    :parent_key => [:id],
    :child_key => [:icon_id]
  belongs_to :image, 'Document',
    :parent_key => [:id],
    :child_key => [:image_id]
end
